package com.yl.home.repo

import com.yl.common.base.BaseRepository
import com.yl.common.network.RespStateData
import com.yl.home.api.HomeApi
import com.yl.home.bean.Article
import com.yl.home.bean.Banner

/**
 * Created by stew on 8/5/22.
 */
class HomeRepo(private val api: HomeApi) : BaseRepository() {

    suspend fun getBanner(bannerList: RespStateData<List<Banner>>) =
        dealResp({ api.getBanner() }, bannerList)

    suspend fun getArticle(page: Int,data:RespStateData<Article>) =
        dealResp({ api.getArticleList(page,10) }, data)

    suspend fun unCollect(id: Int,data:RespStateData<String>) =
        dealResp({ api.unCollect(id) }, data)

    suspend fun collect(id: Int,data:RespStateData<String>) =
        dealResp({ api.collect(id) }, data)
}